package com.ufox.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ufox.entity.Result;
import com.ufox.entity.Services;
import com.ufox.service.IServicesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 优狐科技-www.hbufox.com
 * @since 2022-06-18
 */
@RestController
@RequestMapping("/services")
public class ServicesController {

    @Autowired
    private IServicesService servicesService;

    @PostMapping
    public Result list(){
//        LambdaQueryWrapper<Services> wrapper = new LambdaQueryWrapper<>();
//        wrapper.eq(Services::getParentId,0);
//        List<Services> list = servicesService.list(wrapper);
        List<Services> list = servicesService.list();
        return Result.ok(list);
    }
    @PostMapping("/yi")
    public Result one(){
        LambdaQueryWrapper<Services> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Services::getParentId,1);
        List<Services> list = servicesService.list(wrapper);
        return Result.ok(list);
    }
}

